\ Preprocessor FOOS demo - Copyright 2012 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

\ Translation of:
\ http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming

include 4pp/lib/foos.4pp

:: Animal
   class
     method: Talk
   end-class {}
;

:: Dog
   extends Animal
   end-extends {

     :method { ." Woof" cr } ; defines Talk
   }
;

:: Cat
   extends Animal
   end-extends {

     :method { ." Meow" cr } ; defines Talk
   }
;

static Cat MyCat
static Dog MyDog

MyCat => Talk
MyDog => Talk